package com.gitee.xmhzzz.component.log.user;

import com.gitee.xmhzzz.component.common.context.UserContext;
import com.mzt.logapi.beans.Operator;
import com.mzt.logapi.service.IOperatorGetService;


import java.util.Optional;

/**
 * @ClassName DefaultUserInfoServiceImpl
 * @Description
 * @Author wzq
 * @Date 2023/8/14 18:55
 * @Version 1.0
 */

public class DefaultUserInfoServiceImpl implements IOperatorGetService {

    @Override
    public Operator getUser() {

            return Optional.ofNullable(UserContext.getUserId())
                    .map(a -> new Operator(a))
                    .orElseThrow(()->new IllegalArgumentException("user is null"));


    }
}
